<template>
  <div class="swiper-wrapper" v-if="picDatas.length > 0">
    <swiper :options="swiperOption">
      <swiper-slide
      v-for="(item, index) of picDatas"
      :pic="item"
      :key="index"
      >
        <img class="swiper-img" :src="picDatas[index]">
      </swiper-slide>
      <!-- 轮播播分页组件 -->
      <template #pagination>
        <div class="swiper-pagination" slot="pagination"></div>
      </template>
    </swiper>
  </div>
</template>

<script>
import {swiper, swiperSlide } from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'

export default {
  name: 'DetailSwiper',
  components:{
    swiper,
    swiperSlide ,
  },
  props: {
    picDatas: {
      type: Array,
      default () {
        return [];
      }
    },
  },
  updated () {
    console.log(this.picDatas);
  },
  methods: {
   
  },
  data () {
    return {
      // swiper轮播插件配置项
      swiperOption: {
        pagination: {
          el: '.swiper-pagination',
          clickable:true,
          observer: true,
          observeParents: true,
        }
      }
    }
  }
}
</script>

<style lang="scss" scoped>

.swiper-slide {
  // 设置轮播图高度
  height: 2rem;
}
.swiper-img {
  width: 100%;
  height: 100%;
}
</style>